
const api = require('../../../config/api');
const util = require('../../../utils/util.js');
Page({
  data: {
    reportDetail: {},
    type: '0',  //举报类型 实名|匿名
    object: '0',  //举报对象 个人|单位
    icon: {
      normal: '../../../images/report/unselect_x.png',
      active: '../../../images/report/select_3x.png',
    },
    
  },


  onLoad(options) {
    let {report_id} = options
    this.reportDetail(report_id);
  },
  //请求数据
  reportDetail(report_id) {
    util.request(api.report_detail, {report_id}, 'get').then(res => {
      console.log(res);
      this.setData({
        reportDetail: res.data.reportDetail
      })
      if(res.data.reportDetail.reportType == 1) {
        this.setData({
          type: '1'
        })
      }else {
        this.setData({
          type: '0'
        })
      }
      if(res.data.reportDetail.beReportedType == 0) {
        this.setData({
          object: '0'
        })
      }else {
        this.setData({
          object: '1'
        })
      }
    })
  },
  goReportCore() {
    let param = {
      reportTitle: '',
      reportContent: '',
      reportReply: '',
      fileVoList: ''
    }
    param.reportTitle = this.data.reportDetail.reportTitle;
    param.reportContent = this.data.reportDetail.reportContent;
    param.reportReply = this.data.reportDetail.reportReply;
    param.fileVoList = this.data.reportDetail.fileVoList;
    let p = JSON.stringify(param);
    wx.navigateTo({
      url: '/pages/report/report_core/report_core?p=' + p,
    })
  }
})